home *** CD-ROM | disk | FTP | other *** search
- SIGFPE(3C) Last changed: 9-22-98
-
-
- NNAAMMEE
- hhaannddllee__ssiiggffppeess - Floating-point exception handler package
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssiiggffppee..hh>>
-
- vvooiidd hhaannddllee__ssiiggffppeess ((iinntt oonnooffff,, iinntt eenn__mmaasskk,,
- vvooiidd ((**uusseerr__rroouuttiinnee))((uunnssiiggnneedd[[55]],, iinntt[[22]])),,
- iinntt aabboorrtt__aaccttiioonn,,
- vvooiidd ((**aabboorrtt__rroouuttiinnee))((uunnssiiggnneedd iinntt ****))));;
- vvooiidd ((**uusseerr__rroouuttiinnee))((uunnssiiggnneedd[[55]],, iinntt[[22]])),,
- iinntt aabboorrtt__aaccttiioonn,,
- vvooiidd ((**aabboorrtt__rroouuttiinnee))((uunnssiiggnneedd iinntt ****))));;
-
- ttyyppeeddeeff vvooiidd ((**uusseerr__tt))((uunnssiiggnneedd[[55]],, iinntt[[22]]));;
-
- ttyyppeeddeeff vvooiidd ((**aabboorrtt__tt))((uunnssiiggnneedd iinntt ****));;
-
- ssttrruucctt ssiiggffppee__tteemmppllaattee
- {{
- iinntt rreeppllss;;
- iinntt ccoouunntt;;
- iinntt ttrraaccee;;
- iinntt aabboorrtt;;
- iinntt eexxiitt;;
- }};;
-
- eexxtteerrnn ssttrruucctt ssiiggffppee__tteemmppllaattee ssiiggffppee__[[__NN__EEXXCCEEPPTTIIOONN__TTYYPPEESS++11]];;
-
- eexxtteerrnn iinntt iinnvvaalliiddoopp__rreessuullttss__[[__NN__IINNVVAALLIIDDOOPP__RREESSUULLTTSS++11]];;
-
- eexxtteerrnn iinntt iinnvvaalliiddoopp__ooppeerraannddss__[[__NN__IINNVVAALLIIDDOOPP__OOPPEERRAANNDDSS++11]];;
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- The floating-point accelerator may raise floating-point exceptions,
- signal SSIIGGFFPPEE, due to five conditions: __OOVVEERRFFLL(_o_v_e_r_f_l_o_w),
- __UUNNDDEERRFFLL(_u_n_d_e_r_f_l_o_w), __DDIIVVZZEERROO(_d_i_v_i_d_e-_b_y-_z_e_r_o), __IINNEEXXAACCTT(_i_n_e_x_a_c_t
- _r_e_s_u_l_t), or __IINNVVAALLIIDD(_i_n_v_a_l_i_d _o_p_e_r_a_n_d, e.g., infinity). Usually these
- conditions are masked, and do not cause a floating-point exception.
- Instead, a default value is substituted for the result of the
- operation, and the program continues silently. This event may be
- intercepted by causing an exception to be raised. When this occurs,
- the operating system generates a SIGFPE signal.
-
- The integer arithmetic instructions aadddd, aaddddii, ddaadddd, ddaaddddii, ssuubb, and
- ddssuubb also generate a SIGFPE signal when the result of the operation
- overflows (condition __IINNTT__OOVVEERRFFLL). (Currently, SGI compilers generate
- only uunnssiiggnneedd versions of these instructions, which do not generate a
- signal on overflow. However, it is still possible to generate these
- instructions via assembly language).
-
- For --oo3322 programs, the compiler generates additional instructions to
- detect and trap on integer-divide-by-zero. No similar detection code
- sequences are generated in --nn3322 or --6644 programs.
-
- Once an exception is raised, the specific conditions which caused the
- exception may be determined, and more appropriate action taken.
-
- The lliibbffppee..ssoo library provides two methods to unmask and handle these
- conditions: the subroutine hhaannddllee__ssiiggffppeess, and the environment
- variable TTRRAAPP__FFPPEE. Both methods provide a mechanism for unmasking
- each of these conditions except __IINNEEXXAACCTT, for handling and classifying
- exceptions arising from them, and for substituting either a default
- value or a chosen one. They also provide mechanisms to count, trace,
- exit or abort on enabled exceptions. If you supply your own call to
- hhaannddllee__ssiiggffppeess, you should leave environment variable TTRRAAPP__FFPPEE
- undefined or set to OFF. TTRRAAPP__FFPPEE is supported for Fortran, C, C++
- and Pascal. hhaannddllee__ssiiggffppeess is supported for C, C++ and Fortran.
-
- Calling the subroutine is the preferred method when preparing software
- for others to use, since it relieves the user of any need to know
- about the TTRRAAPP__FFPPEE environment variable.
-
- The environment variable is preferable if you want to experiment or
- allow any user to experiment with different trap behaviors with
- minimum effort.
-
- lliibbffppee uses System V signal handling and will not work with programs
- that use Berkeley signal handling.
-
- Note that the preferred method for flushing denormals to zero is to
- set the FS bit to 1 in the floating point control status register. If
- the FS bit is set to 1, the user should not handle underflows through
- the floating point trap handler, because a denormal result flushed to
- zero will cause an underflow. Note that calls to the floating point
- trap handler consume many thousands of cpu cycles. The following
- routine (written in C) can be used to set/clear the FS bit.
-
- #include <sys/fpu.h>
-
- void
- flush_to_zero(int on_off)
- {
- union fpc_csr n;
-
- n.fc_word = get_fpc_csr();
- if ( on_off == 0 ) {
- n.fc_struct.flush = 0;
- } else {
- n.fc_struct.flush = 1;
- }
- set_fpc_csr(n.fc_word);
- }
-
- Note that if the FS bit in the floating point control status register
- is set, it remains set after calling hhaannddllee__ssiiggffppeess((__OOFFFF,, ......
-
- Be sure to read the NOTES FOR R8000 section on this man page, which
- describes the behavior of lliibbffppee..ssoo on the R8000 processor.
-
- HHAANNDDLLEE__SSIIGGFFPPEESS SSUUBBRROOUUTTIINNEE
- The values in the global arrays are described in the ""WWHHEENN AANN
- EEXXCCEEPPTTIIOONN IISS EENNCCOOUUNNTTEERREEDD"" section on this man page.
-
- The arguments to hhaannddllee__ssiiggffppeess are as follows:
-
- oonnooffff
- Indicates whether handling is turned on ((oonnooffff ==== __OONN)) or off
- ((oonnooffff ==== __OOFFFF)). Specifying ((oonnooffff ==== __DDEEBBUUGG)) is another way to
- turn on handling. Information from the ssiiggffppee structure will be
- printed if ((oonnooffff ==== __DDEEBBUUGG)). (The names used in this document
- are defined in ssiiggffppee..hh.)
-
- eenn__mmaasskk
- Indicates which of the five conditions should be unmasked,
- enabling them to raise floating-point exceptions/or an integer
- overflow exception. eenn__mmaasskk is valid only if oonnooffff ==== __OONN or
- oonnooffff ==== __DDEEBBUUGG, and is the bitwise or of one or more of the
- constants _EN_UNDERFL, _EN_OVERFL, _EN_DIVZERO, _EN_INVALID, and
- _EN_INT_OVERFL (defined in ssiiggffppee..hh).
-
- uusseerr__rroouuttiinnee::
- hhaannddllee__ssiiggffppeess provides a mechanism for setting the result of the
- operation to any one of a set of well-known values. If full
- control over the value of selected operations is desired for one
- or more exception conditions, a function uusseerr__rroouuttiinnee must be
- provided. For these selected exception conditions, uusseerr__rroouuttiinnee
- will be called to set the value resulting from the operation.
- Pass a 0 (plain 0 is adequate) if you do not want to provide a
- uusseerr__rroouuttiinnee. Typedef uusseerr__tt is defined in ssiiggffppee..hh for
- convenience in programming.
-
- aabboorrtt__aaccttiioonn::
- If the handler encounters an unexpected condition or an
- inconsistency, the flag aabboorrtt__aaccttiioonn indicates what action should
- be taken. Another option is for you to specify that you are
- supplying your own floating point exception handler as the
- default handler. The following legal values can be specified:
-
- _TURN_OFF_HANDLER_ON_ERROR
- Instruct the floating-point-accelerator to cease causing
- exceptions and continue (i.e., disable handling).
-
- _ABORT_ON_ERROR
- Kill the process after giving an error message and calling a
- user-supplied cleanup routine if one is provided via the
- aabboorrtt__rroouuttiinnee parameter.
-
- _REPLACE_HANDLER_ON_ERROR
- Install the indicated user routine as the handler when such
- an error is encountered. Future floating-point exceptions
- will branch to the user-routine (see ssiiggnnaall(2)).
-
- _USER_HANDLER
- Install the indicated user routine as the handler
- immediately. Future floating-point exceptions will branch
- to the user-routine (see ssiiggnnaall(2)).
-
- aabboorrtt__rroouuttiinnee::
- When a fatal error (i.e., one described under aabboorrtt__aaccttiioonn) is
- encountered, aabboorrtt__rroouuttiinnee is used as the address of a user
- routine.
-
- If abort_action is _ABORT_ON_ERROR, and aabboorrtt__rroouuttiinnee is valid,
- it is called before aborting, and passed a pointer to the address
- of the instruction causing the exception as its single argument.
- In this case, the user's abort_routine should be defined as
- follows:
-
- void abort_routine( ptr_to_pc )
- unsigned int **ptr_to_pc;
-
- If aabboorrtt__aaccttiioonn is _REPLACE_HANDLER_ON_ERROR, and aabboorrtt__rroouuttiinnee is
- valid, it will be installed as the new handler. In this case,
- aabboorrtt__rroouuttiinnee will be called immediately to handle the current
- exception. (see ssiiggnnaall(2)) Pass a 0 (plain 0 is adequate) if you do
- not want to provide an aabboorrtt__aaccttiioonn routine.
-
- If aabboorrtt__aaccttiioonn is _USER_HANDLER, and aabboorrtt__rroouuttiinnee is valid, it will
- be installed immediately as the default floating point exception
- handler.
-
- If aabboorrtt__rroouuttiinnee is to be invoked as a floating point exception
- handler, the following prototype should be used (see <<ssiiggffppee..hh>>,
- <<ssyyss//ssiiggnnaall..hh>>, and ssiiggnnaall(2)):
-
- int user_handler( sig, code, sc )
- int sig, code;
- struct sigcontext *sc;
-
- Typedef aabboorrtt__tt is defined in ssiiggffppee..hh for convenience in programming.
-
- Routine user_handler should return 0 to continue processing of the
- user's code and a non-zero value to disconnect user_handler as the
- floating point exception handler. User_handler should not issue a
- call to ssiiggnnaall(), nor should it update the program counter in the
- sigcontext area, because these actions are done in the routine which
- calls it. A user handler can determine which type of exception has
- occurred by calling routine ____ffppee__ttrraapp__ttyyppee(). This routine returns
- one of _UNDERFL, _OVERFL, etc. as appropriate.
-
- Users can supply separate handlers for each exception type by making
- multiple calls to handle_sigfpes. See example 3 that follows.
- Similarly, trap handling for one or more exception types can be turned
- off by or-ing the appropriate combination of masks in the second
- parameter to handle_sigfpes.
-
- handle_sigfpes(OFF, 0, ...
-
- disables handling of all SIGFPE signals.
-
- EEXXAAMMPPLLEESS OOFF CCAALLLLSS TTOO HHAANNDDLLEE__SSIIGGFFPPEESS
- The following example sets up traps of underflow which change the
- resulting value to zero:
-
- #include <sigfpe.h>
-
- /* call this during program startup
- to set underflowing values to zero
- */
-
- void my_underflow_to_zero(void)
- {
- /* underflow to zero */
-
- sigfpe_[_UNDERFL].repls = _ZERO;
-
- /* only trap on underflow */
-
- handle_sigfpes(_ON, _EN_UNDERFL , 0, _ABORT_ON_ERROR, 0);
- }
-
- The following example counts all traps, traces the first five
- exceptions of each kind, aborts on the first divide by zero, or the
- 100th overflow. It replaces zero for underflows, max float/double for
- overflows, max integer for integer overflows, and the default values
- for divide by zero, invalid operands, and integer overflows. The
- environment variable example below does the same thing.
-
- #include <limits.h> /* to get INT_MAX */
- #include <sigfpe.h>
-
- main()
- {
- /* underflow to zero */
-
- sigfpe_[_UNDERFL].repls = _ZERO;
-
- /* substitute max float/double on overflow */
-
- sigfpe_[_OVERFL].repls=_MAX;
-
- /* trace first 5 exceptions of each kind */
-
- sigfpe_[_UNDERFL].trace=5;
- sigfpe_[_OVERFL].trace =5;
- sigfpe_[_DIVZERO].trace=5;
- sigfpe_[_INVALID].trace=5;
- sigfpe_[_INT_OVERFL].trace=5;
-
- /* counts at end */
-
- sigfpe_[_UNDERFL].count=INT_MAX;
- sigfpe_[_OVERFL].count =INT_MAX;
- sigfpe_[_DIVZERO].count=INT_MAX;
- sigfpe_[_INVALID].count=INT_MAX;
- sigfpe_[_INT_OVERFL].count=INT_MAX;
-
- /* abort after 100 */
-
- sigfpe_[_UNDERFL].abort=100;
- sigfpe_[_OVERFL].abort =100;
- sigfpe_[_INVALID].abort=100;
- sigfpe_[_INT_OVERFL].abort=100;
-
- /* abort on first divide by zero */
-
- sigfpe_[_DIVZERO].abort=1;
-
-
-
- handle_sigfpes(_ON, _EN_UNDERFL| _EN_OVERFL|_EN_DIVZERO
- | _EN_INVALID | _EN_INT_OVERFL, 0, _ABORT_ON_ERROR, 0);
-
- /* do the real application work here */
- }
-
- The last example shows how to enable different handlers for various
- exception types:
-
- #include <limits.h> /* to get INT_MAX */
- #include <sigfpe.h>
-
- extern user_t my_invalid_handler;
-
- main()
- {
- /* counts at end */
-
- sigfpe_[_UNDERFL].count=INT_MAX;
- sigfpe_[_OVERFL].count =INT_MAX;
- sigfpe_[_DIVZERO].count=INT_MAX;
- sigfpe_[_INVALID].count=INT_MAX;
- sigfpe_[_INT_OVERFL].count=INT_MAX;
-
- /* enable trapping on overflow, using libfpe's trap handler */
-
- handle_sigfpes(_ON, _EN_OVERFL, 0, 0, 0);
-
- /* enable trapping on invalid, using user's own trap handler */
-
- handle_sigfpes(_ON, _EN_INVALID, my_invalid_handler, 0, 0);
-
- /* do the real application work here */
-
- ....
-
- /* turn off trapping of overflows */
-
- handle_sigfpes(_OFF, _EN_OVERFL, 0, 0, 0);
-
- ....
-
- /* turn off all handling of SIGFPE signals */
-
- handle_sigfpes(_OFF, 0, 0, 0, 0);
-
- ....
-
- TThhee TTRRAAPP__FFPPEE EEnnvviirroonnmmeenntt VVaarriiaabbllee
- If the code has been linked with lliibbffppee..ssoo, the runtime startup
- routine will check for the environment variable TTRRAAPP__FFPPEE. The string
- read as the value of TTRRAAPP__FFPPEE will be interpreted and hhaannddllee__ssiiggffppeess
- will be called with the resulting values.
-
- TTRRAAPP__FFPPEE is read in uppercase letters only. The string assigned to
- TTRRAAPP__FFPPEE may be in uppercase or lowercase. TTRRAAPP__FFPPEE can take one of
- two forms: either a global value, or a list of individual items.
-
- Global values:
-
- "" or OFF
- Execute the program with no trap handling enabled. Same as
- TTRRAAPP__FFPPEE undefined. Same as linking without lliibbffppee..ssoo
-
- ON Same as TTRRAAPP__FFPPEE==""AALLLL==DDEEFFAAUULLTT"".
-
- Alternately, replacement values and actions may be specified for
- each of the possible trap types individually. This is
- accomplished by setting the environment variable as follows:
-
- setenv TRAP_FPE "_i_t_e_m;_i_t_e_m;_i_t_e_m...."
-
- An _i_t_e_m can be one of the following:
-
- traptype=statuslist
- Where traptype defines the specific floating point exception to
- enable, and statuslist defines the list of actions upon
- encountering the trap.
-
- DEBUG
- Confirm the parsing of the environment variable and the trap
- actions.
-
- Traptype can be one of the following literal strings:
-
- UNDERFL
- underflow
-
- OVERFL
- overflow
-
- DIVZERO
- divide by zero
-
- INVALID
- invalid operand
-
- INT_OVERFL
- integer overflow
-
- ALL all of the above
-
- Statuslist is a list separated by commas. It contains an optional
- symbolic replacement value, and an optional list of actions.
-
- Symbolic replacement values:
-
- DEFAULT
- Do not override the predefined default values.
-
- IEEE Maps to integer code _APPROPRIATE.
-
- APPROPRIATE
- Maps to integer code _APPROPRIATE.
-
- ZERO Maps to integer code _ZERO.
-
- FLUSH_ZERO
- Maps to integer code _FLUSH_ZERO (R4000 and later processors).
-
- FLUSH_ZERO
- Maps to integer code _ZERO (other processors).
-
- MIN Maps to integer code _MIN.
-
- MAX Maps to integer code _MAX.
-
- INF Maps to integer code _INF.
-
- NAN Maps to integer code _NAN.
-
- All actions take an optional integer in parentheses:
-
- Note: for any traps that have an action and no specified replacement
- value, the DEFAULT replacement value will be used.
-
- COUNT(_n)
- A count of the trap type will be printed to stderr every nth
- trap, and at the end of the program. Default is INT_MAX.
-
- ABORT(_n)
- Core dump and abort the program upon encountering the nth trap.
- Default is 1.
-
- EXIT(_n)
- Exit program upon encountering the nth trap. Default is 1.
-
- TRACE(_n)
- If a trap is encountered, print a stack trace to stderr up to _n
- times. Default is 10.
-
- EEXXAAMMPPLLEESS OOFF TTRRAAPP__FFPPEE
- The following example counts all traps, traces the first five
- overflows, aborts on the first divide by zero, or the 100th overflow.
- It replaces zero for underflows, the "appropriate" value for
- overflows, and the default values for divide by zero, invalid
- operands, and integer overflows.
-
- setenv TTRRAAPP__FFPPEE "ALL=COUNT; UNDERFL=ZERO; OVERFL=IEEE,TRACE(5),
- ABORT(100); DIVZERO=ABORT"
-
- WWHHEENN AANN EEXXCCEEPPTTIIOONN IISS EENNCCOOUUNNTTEERREEDD
- When an exception is encountered, the handler examines the instruction
- causing the exception, the state of the floating-point accelerator and
- the sigfpe structure to determine the correct action to take, and the
- program is continued. In the cases of __UUNNDDEERRFFLL,, __OOVVEERRFFLL,, __DDIIVVZZEERROO,,
- __IINNTT__OOVVEERRFFLL,, and some instances of __IINNVVAALLIIDD,, an appropriate value is
- substituted for the result of the operation, and the instruction which
- caused the exception is skipped. For most exceptions arising due to
- an invalid operand ( exceptions), more meaningful behavior may be
- obtained by replacing an erroneous operand. For these conditions, the
- operand is replaced, and the instruction re-issued.
-
- _s_i_g_f_p_e:
- For each enabled exception, the sigfpe structure contains the
- following fields: repls, count, trace, exit and abort. For each
- enabled exception <_p>, and each non-zero entry <_n> in the sigfpe
- structure, the trap handler will take the following actions:
-
- ccoouunntt::
- A count of all enabled traps will be printed to stderr at the end
- of execution of the program, and every at <_n>th exception <_p>.
-
- ttrraaccee::
- A dbx stack trace will be printed to stderr every exception <_p>,
- up to <_n> times. You must have dbx installed on your system to
- use this option.
-
- aabboorrtt::
- Core dump and abort program upon encountering the <_n>th exception
- <_p>. The abort option takes precedence over the exit option.
-
- eexxiitt::
- Exit program upon encountering the <_n>th exception <_p>.
-
- rreeppllss::
- Each of the exceptions __UUNNDDEERRFFLL, __OOVVEERRFFLL, __DDIIVVZZEERROO, and
- __IINNTT__OOVVEERRFFLL has an associated default value which is used as the
- result of the operation causing the exception. These default
- values may be overridden by initializing this integer value.
- This value is interpreted as an integer code used to select one
- of a set of replacement values, or to indicate that the
- _u_s_e_r__r_o_u_t_i_n_e routine is responsible for setting the value. These
- integer codes are listed below:
-
- _ZERO
- Use zero as the replacement value
-
- _FLUSH_ZERO
- Set the flush_zero bit in the Control Status register. This
- causes a flush to zero without invoking the trap handler. Works
- only for underflow traps on the R4000 and later processors.
- Works like _ZERO for the R3000.
-
- _MIN Use the appropriately-typed minimum value as the replacement
- (i.e., the smallest number which is representable in that format
- without denormalizing).
-
- _MAX Use the appropriately-typed maximum value as the replacement.
-
- _INF Use the appropriately-typed value for infinity as the
- replacement.
-
- _NAN Use the appropriately-typed value for not-a-number as the
- replacement. (A quiet not-a-number is used.)
-
- _APPROPRIATE
- Use IEEE standard results as the return result for __UUNNDDEERRFFLL,
- __OOVVEERRFFLL, __DDIIVVZZEERROO, and __IINNVVAALLIIDD exceptions.
-
- _USER_DETERMINED
- Invoke the routine _u_s_e_r__r_o_u_t_i_n_e (see note) to set the value of
- the operation. If this is the code used for exceptions, all
- such exceptions will defer to _u_s_e_r__r_o_u_t_i_n_e to set their value.
- In this case, _i_n_v_a_l_i_d_o_p__r_e_s_u_l_t_s_ and _i_n_v_a_l_i_d_o_p__o_p_e_r_a_n_d_s_ will be
- ignored.
-
- _NEG Use the negative of the argument as the replacement operand.
- This code is valid only for the cases __SSQQRRTT__NNEEGG__XX and
- __RRSSQQRRTT__NNEEGG__XX (see below).
-
- The default values used as the results of floating-point exceptions
- are:
-
- ----------------------------------------------------------------------
- Element
- # mnemonic Exception condition Default value
- ----------------------------------------------------------------------
- 0 (none) (ignored)
- 1 _UNDERFL underflow _APPROPRIATE
- 2 _OVERFL overflow _APPROPRIATE
- 3 _DIVZERO divide-by-zero _APPROPRIATE
- 4 _INVALID invalid operand (use tables)
- 5 _INT_OVERFL integer overflow _MAX
- ----------------------------------------------------------------------
-
- The default values for __UUNNDDEERRFFLL, __OOVVEERRFFLL, __DDIIVVZZEERROO, and __IINNVVAALLIIDD
- exceptions will produce the same results as if the instruction were
- re-issued with the original operand(s) and floating-point traps
- disabled.
-
- Valid values for ssiiggffppee__[[__IINNTT__OOVVEERRFFLL]]..rreeppllss are: __MMAAXX, AAPPPPRROOPPRRIIAATTEE,
- __ZZEERROO, and __UUSSEERR__DDEETTEERRMMIINNEEDD, the default being __MMAAXX.
-
- For exceptions, the correct action may be either to set the result
- and skip the instruction, or to replace an operand and retry the
- instruction. There are four cases in which the result is set. The
- array named _i_n_v_a_l_i_d_o_p__r_e_s_u_l_t_s_ is consulted for replacement codes for
- these cases:
-
- ----------------------------------------------------------------------
- Default
- # Element mnemonic Exception condition value
- ----------------------------------------------------------------------
- 0 (none) (ignored)
- 1 _MAGNITUDE_INF_SUBTRACTIONoo - oo _NAN
- 2 _ZERO_TIMES_INF 0 * oo _NAN
- 3 _ZERO_DIV_ZERO 0/0 _NAN
- 4 _INF_DIV_INF oo / oo _NAN
- ----------------------------------------------------------------------
-
- There are ten cases in which an offending operand is replaced. An
- array named _i_n_v_a_l_i_d_o_p__o_p_e_r_a_n_d_s_ is consulted for user-initialized
- codes for these cases. Cases 8 through 11 are valid only for the
- mips3 and later architectures. Array _i_n_v_a_l_i_d_o_p__o_p_e_r_a_n_d_s_ has only 8
- entries (0-7) for the earlier processors. Each element governs the
- following cases:
-
- ----------------------------------------------------------------------
- Element
- # mnemonic Exception condition Default value
- ----------------------------------------------------------------------
- 0 (none) (ignored)
- 1 _SQRT_NEG_X sqrt(-x) reissue
- 2 (unused) (ignored) with original
- 3 _CVTW_OVERFL conversion to integer operands and
- caused target to
- overflow
- 4 _CVTW_NA conversion of NaN to iinntt floating point
- 5 _CVTW_INF conversion of oo to iinntt traps disabled
- 6 _UNORDERED_CMPcomparison to NaN
- 7 _SNAN_OP operand was Signaling
- NaN
- 8 _CVTL_OVERFL conversion to lloonngg lloonngg
- caused target to
- overflow
- 9 _CVTL_NAN conversion of NaN to
- lloonngg lloonngg
- 10 _CVTL_INF conversion of oo to lloonngg
- lloonngg
- 11 _RSQRT_NEG_X reciprocal sqrt(-x)
- ----------------------------------------------------------------------
-
- WWAARRNNIINNGGSS
- hhaannddllee__ssiiggffppeess is not reentrant. In particular, it must not be called
- from within an exception handler.
-
- NNOOTTEESS
- ""UUssee ooff _u_s_e_r__r_o_u_t_i_n_e ttoo sseett vvaalluueess""
- If the integer code defining the replacement value for a
- particular exception condition is _USER_DETERMINED, the user-
- supplied routine _u_s_e_r__r_o_u_t_i_n_e is called:
-
- ((**uusseerr__rroouuttiinnee))((eexxcceeppttiioonn__ppaarraammeetteerrss,, vvaalluuee));;
- _v_a_l_u_e
- An array of two _i_n_ts into which _u_s_e_r__r_o_u_t_i_n_e should store the
- replacement value. If an operand is being replaced, _v_a_l_u_e has a
- copy of the current operand.
-
- _e_x_c_e_p_t_i_o_n__p_a_r_a_m_e_t_e_r_s
- An array of five _u_n_s_i_g_n_e_d _i_n_ts which describe the following
- exception condition:
-
- --------------------------------------------------------------------
- # Element mnemonic Description
- --------------------------------------------------------------------
- 0 _EXCEPTION_TYPE The exception type (_DIVZERO, etc).
- 1 _INVALID_ACTION value = _SET_RESULT if result is
- being set. value = _REPL_OPERAND
- if an operand is being replaced.
- This element is meaningful only if
- the exception type is .
- 2 _INVALID_TYPE This element is meaningful only if
- the exception type is . It is the
- index corresponding to the
- particular conditions giving rise
- to the exception. In conjunction
- with element 1, this value uniquely
- determines the exception condition.
- (e.g., if _INVALID_ACTION is
- _SET_RESULT and _INVALID_TYPE is 2,
- the exception is due to
- _ZERO_TIMES_INF.)
- 3 _VALUE_TYPE The type of the replacement value -
- either _SINGLE, _DOUBLE, _WORD, or
- _LONGWORD
- 4 _VALUE_SIGN T{ The suggested sign _u_s_e_r__r_o_u_t_i_n_e
- should use for the replacement
- value - either _POSITIVE or
- _NEGATIVE.
- --------------------------------------------------------------------
-
- NNOOTTEESS FFOORR RR88000000
- Due to the nature of parallel operations on the R8000 processor, it is
- not possible to determine the true value of the program counter when a
- floating point exception occurs. Therefore, on that processor,
- lliibbffppee..ssoo will not update either operands or results when floating
- point exceptions occur. Another anomaly on this processor is that
- counts of floating point exceptions for a particular program may vary
- from run to run.
-
- When the R8000 processor executes in precise exception mode, lliibbffppee
- behaves as it does on other processors, i.e. operands and results can
- be updated when floating point exceptions occur. See ffppmmooddee(1).
-
- SSEEEE AALLSSOO
- ffppcc(3c), ffssiiggffppee(3f), ggeett__ffppcc__ccssrr(3c), sseett__ffppcc__ccssrr(3c), ssiiggnnaall(3c)
-
- This man page is available only online.
-
-